<template>
	<div>
		<van-field
		  v-model="item"
		  center
		  clearable
		  border
		  placeholder="请输入任务"
			left-icon="chat-o"
		>
		  <template #button>
		    <van-button size="small" type="primary" @click="addItem" icon="plus">添加任务</van-button>				
		  </template>
		</van-field>	
		
	</div>
</template>

<script>
export default {
	data(){
		return {
			item:"输入一个任务项...",
		}
	},
	
	methods:{
		addItem(){
			//触发父组件的自定义事件，把参数传过去
			this.$emit("addItem",this.item)	
								
		}
	}
};
</script>
